package br.com.lambdacore.persistence.validator;

import br.com.lambdacore.model.EntityModel;
import br.com.lambdacore.validator.Validator;

public class ModelValidator extends Validator<EntityModel<?>> {

	protected ModelValidator(EntityModel<?> entityModel) {
		super(entityModel);
	}

	public boolean notNullId() {
		return !this.nullId();
	}

	public boolean notNullOrNullId() {
		return !this.nullOrNullId();
	}

	public boolean nullId() {
		return is(this.getObject().getId()).nil();
	}

	public boolean nullOrNullId() {
		return this.nil() || this.nullId();
	}

	public static ModelValidator is(EntityModel<?> entityModel) {
		return new ModelValidator(entityModel);
	}
}
